package 线程.阻塞队列;

import java.util.concurrent.ArrayBlockingQueue;

public class Foodie extends Thread{
    ArrayBlockingQueue<String> queue;
    public Foodie(ArrayBlockingQueue<String> queue){
        this.queue=queue;
    }
    @Override
    public void run() {
        while (true) {
            //消费者吃食物
            try {
                queue.take();
                System.out.println("消费者吃食物");
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
